package Com.Hupochuan.Dal.Util;

import java.sql.Timestamp;

import Com.Hupochuan.Dal.DBManager.DBManager;
import Com.Hupochuan.Vo.Admin;

/*
 * 时间工具持久层
 */
public class TimeUtil {
	
	/*
	 * 本类私有对象
	 */
	private DBManager<Admin> dbManager = new DBManager<Admin>(Admin.class);
	
	/*
	 * 单一实例
	 */
	private TimeUtil(){}
	private static TimeUtil timeUtil = new TimeUtil();
	public static TimeUtil getObject(){
		return timeUtil;
	}
	
	/*
	 * 获得数据库当前系统时间
	 */
	public Timestamp findDBNowTime(){
		
		//参数部分
		Timestamp nowTime = new Timestamp(System.currentTimeMillis());
		StringBuffer sqlBuff = new StringBuffer();
		
		//sql语句部分
		sqlBuff.append(" select now() as nowTime ");

		//执行sql
		nowTime = dbManager.executeQuerySqlReturnTimestamp(sqlBuff.toString());
		
		//返回
		return nowTime;
	}
}
